package cc.ls5l.tools.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;

import java.awt.*;

public class QrCodeConfig {
    public void renderQrCode(String qrContent,String savePath){
        QrConfig config = new QrConfig(300,300);
        // 设置边距
        config.setMargin(3);
        // 前景色
        Color frontColor = new Color(0,0,0);
        Color bgColor = new Color(255,255,255);
        config.setForeColor(frontColor.getRGB());
        config.setBackColor(bgColor.getRGB());
        // 附带logo
        //config.setImg("");
        QrCodeUtil.generate(qrContent,config, FileUtil.file(savePath));
    }
}
